/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hotelsupplymanagement;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;


class CLViewing {
    private FileReader frs;
    private BufferedReader br;
    String[] cline;
    String s,s1;
    


    void CLviewInventory() 
    {
              try
                  {
                    int i=0;
                    ArrayList<GetInventories> inv=new ArrayList<GetInventories>();
                    frs=new FileReader("GUIItem.txt");
                    br=new BufferedReader(frs);
                    while((s1=br.readLine()) != null)
                        {
                            inv.add(new GetInventories());
                            cline=s1.split(",");
                            inv.get(i).setInventoryName(cline[0]);
                            inv.get(i).setInventoryId(Integer.parseInt(cline[1]));
                            inv.get(i).setInventoryQuantity(Integer.parseInt(cline[2]));
                            inv.get(i).setInventoryPrice(Integer.parseInt(cline[3]));
                            i++;
                        }
                    for(int n=0;n<i;n++)
                    {
                        System.out.println("Name :"+inv.get(n).getInventoryName()+" ID "+inv.get(n).getInventoryId()+" Quality "+inv.get(n).getInventoryQuantity()+" Price "+inv.get(n).getInventoryPrice());
                                            }
                    }
		catch(Exception ex)
		{
                    System.out.println("Error in inventory");
		}

    }

    void CLviewProducts()
    {
        try
                {
                    int i=0;
                    ArrayList<GetProducts> pro=new ArrayList<GetProducts>();
                    frs=new FileReader("GUIProduct.txt");
                    br=new BufferedReader(frs);
                    while((s=br.readLine()) != null)
                        {
                            pro.add(new GetProducts());
                            cline=s.split(",");
                            pro.get(i).setProductName(cline[0]);
                            pro.get(i).setProductId(Integer.parseInt(cline[1]));
                            pro.get(i).setProductQuality(Integer.parseInt(cline[2]));
                            pro.get(i).setProductDescription(cline[3]);
                            pro.get(i).setProductInvList(cline[4]);
                            i++;
                        }

                    for(int n=0;n<i;n++)
                        {
                            System.out.println("Name :"+pro.get(n).getProductName()+" ID "+pro.get(n).getProductId()+" Quality :"+pro.get(n).getProductQuality()+" Description :"+pro.get(n).getProductDescription()+" Inventory list :"+pro.get(n).getProductInvList());

                        }

                }

		catch(Exception ex)
		{
                    System.out.println("Error in CL view product");
                }
    }

}
